import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FoundationInfoVO, FoundationInfoForm, FoundationInfoQuery, ParkmanagementInformationForm } from '@/api/zichanguanli/foundationInfo/types';

/**
 * 查询园区基础信息列表
 * @param query
 * @returns {*}
 */

export const listFoundationInfo = (query?: FoundationInfoQuery): AxiosPromise<FoundationInfoVO[]> => {
  return request({
    url: '/zichanguanli/foundationInfo/list',
    method: 'get',
    params: query
  });
};

/**
 *园区总览接口
 * @param query
 * @returns
 */
export const overview = (query?: FoundationInfoQuery): AxiosPromise<FoundationInfoVO[]> => {
  return request({
    url: '/zichanguanli/foundationInfo/overview',
    method: 'get',
    params: query
  });
};

/**
 * 查询园区基础信息列表 不分页
 */

export const listFoundationInfoList = (): AxiosPromise<FoundationInfoVO[]> => {
  return request({
    url: '/zichanguanli/foundationInfo/list',
    method: 'get'
  });
};
/**
 * 查询园区基础信息详细
 * @param id
 */
export const getFoundationInfo = (id: string | number): AxiosPromise<FoundationInfoVO> => {
  return request({
    url: '/zichanguanli/foundationInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增园区基础信息
 * @param data
 */
export const addFoundationInfo = (data: FoundationInfoForm) => {
  return request({
    url: '/zichanguanli/foundationInfo',
    method: 'post',
    data: data
  });
};

/**
 * 新增园区经营信息
 * @param data
 */
export const addParkmanagementInformation = (data: ParkmanagementInformationForm) => {
  return request({
    url: '/zichanguanli/parkmanagementInformation',
    method: 'post',
    data: data
  });
};

/**
 * 新增园区经营信息
 * @param data
 */
export const updateParkmanagementInformation = (data: ParkmanagementInformationForm) => {
  return request({
    url: '/zichanguanli/parkmanagementInformation',
    method: 'put',
    data: data
  });
};

/**
 * 获取园区经营信息详细信息
 * @param data
 */
export const getParkmanagementInformationList = (query: any) => {
  return request({
    url: `/zichanguanli/parkmanagementInformation/list`,
    method: 'get',
    params: query
  });
};

/**
 * 获取园区经营信息详细信息
 * @param data
 */
export const delParkmanagementInformationList = (ids: any) => {
  return request({
    url: `/zichanguanli/parkmanagementInformation/${ids}`,
    method: 'delete'
  });
};

/**
 * 修改园区基础信息
 * @param data
 */
export const updateFoundationInfo = (data: ParkmanagementInformationForm) => {
  return request({
    url: '/zichanguanli/foundationInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除园区基础信息
 * @param id
 */
export const delFoundationInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/foundationInfo/' + id,
    method: 'delete'
  });
};
